/**
 * 
 */
package jvs.peer.io;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Temporary file for "one time" use, the underlying file will be automatically deleted after the
 * stream is closed
 * 
 * @author qiangli
 * 
 */
public class OnetimeFile extends File {

	/**
	 * @param path
	 */
	public OnetimeFile(java.io.File file) {
		super(file);
	}

	@Override
	public InputStream getInputStream() throws FileNotFoundException {
		return new DeleteFileInputStream(file);
	}

	@Override
	public OutputStream getOutputStream() throws FileNotFoundException {
		return new DeleteFileOutputStream(file);
	}
}
